formats to make operator overload easier to create for those.
url_next->url = cet_convert_string(url_next->url);
url_next->url_link_text = cet_convert_string(url_next->url_link_text);
}
- gc_data->placer = cet_convert_string(gc_data->placer);
- gc_data->hint = cet_convert_string(gc_data->hint);
+ if (gc_data) {
+ gc_data->placer = cet_convert_string(gc_data->placer);
+ gc_data->hint = cet_convert_string(gc_data->hint);
+ }
fs = wpt->fs;
while (fs != NULL) {
case XT_ISO_TIME_MS:
wpt->creation_time = xml_parse_time(s, &wpt->microseconds);
break;
- case XT_NET_TIME:
- dotnet_time_to_time_t(atof(s), &wpt->creation_time, &wpt->microseconds);
+ case XT_NET_TIME: {
+ time_t tt = wpt->creation_time;
+ dotnet_time_to_time_t(atof(s), &tt, &wpt->microseconds);
+ }
break;
case XT_GEOCACHE_LAST_FOUND:
waypt_alloc_gc_data(wpt)->last_found = yyyymmdd_to_time(s);
writebuff(buff, fmp->printfc, TIMET_TO_EXCEL(wpt->creation_time));
break;
case XT_TIMET_TIME:
- /* time as a time_t variable */
- writebuff(buff, fmp->printfc, wpt->creation_time);
+ /* time as a time_t variable */ {
+ time_t tt = wpt->creation_time;
+ writebuff(buff, fmp->printfc, tt); }
break;
case XT_TIMET_TIME_MS: {
/* time as a time_t variable in milliseconds */
int hms, ymd;
struct tm* tm;
- tm = gmtime(&wpt->creation_time);
+ const time_t tt = wpt->creation_time;
+ tm = gmtime(&tt);
hms = tm->tm_hour * 10000 + tm->tm_min * 100 + tm->tm_sec;
ymd = tm->tm_mday * 10000 + tm->tm_mon * 100 + tm->tm_year;
+
snprintf(tbuf, sizeof(tbuf), ",%d,%d",ymd, hms);
strcat(obuf, tbuf);
}
my_writewpt(const waypoint* wpt)
{
struct record* rec;
- struct tm* tm;
char* vdata;
- time_t tm_t;
const char* sn = global_opts.synthesize_shortnames ?
mkshort_from_wpt(mkshort_handle, wpt) :
wpt->shortname;
rec = (struct record*) xcalloc(sizeof(*rec)+56,1);
+ time_t tm_t;
+ struct tm* tm;
tm = NULL;
if (wpt->creation_time) {
- tm = gmtime(&wpt->creation_time);
+ const time_t tt = wpt->creation_time;
+ tm = gmtime(&tt);
}
if (!tm) {
tm_t = current_time();
static void
data_write(void)
{
- static char* appinfo =
+ static const char* appinfo =
"\0\x01"
"User\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
lat = degrees2ddmm(wpt->latitude);
lon = degrees2ddmm(wpt->longitude);
- tm = gmtime(&wpt->creation_time);
+ time_t ct = wpt->creation_time;
+ tm = gmtime(&ct);
if (tm) {
hms = tm->tm_hour * 10000 + tm->tm_min * 100 + tm->tm_sec;
ymd = tm->tm_mday * 10000 + tm->tm_mon * 100 + tm->tm_year;
struct tm *tm;
memset(&bc, 0, sizeof(bc));
- tm = localtime(&wpt->creation_time);
+ const time_t tt = wpt->creation_time;
+ tm = localtime(&tt);
if (wpt->creation_time) {
- tm = gmtime(&wpt->creation_time);
+ const time_t tt = wpt->creation_time;
+ tm = gmtime(&tt);
}
strcpy(bc.id, header_id);
track_points++;
all_track_points++;
- tm = *localtime(&wpt->creation_time);
+ time_t ct = wpt->creation_time;
+ tm = *localtime(&ct);
strftime(tbuf, sizeof(tbuf), "%d.%m.%Y,%H:%M.%S", &tm);
calculate(wpt, &dist, &speed, &course, NULL, NULL);
}
}
if FIELD_USED(fld_fix) {
- char *fix;
+ const char *fix;
switch (wpt->fix) {
case fix_none:
fix = "none";
time += atoi(opt_utc) * SECONDS_PER_HOUR;
tm = *gmtime(&time);
} else {
- tm = *localtime(&wpt->creation_time);
+ const time_t tt = wpt->creation_time;
+ tm = *localtime(&tt);
}
tm.tm_year += 1900;
tm.tm_mon += 1;
time += atoi(opt_utc) * SECONDS_PER_HOUR;
tm = *gmtime(&time);
} else {
- tm = *localtime(&wpt->creation_time);
+ const time_t tt = wpt->creation_time;
+ tm = *localtime(&tt);
}
snprintf(buf, sizeof(buf), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec);
xml_fill_in_time(char *time_string, const time_t timep, int microseconds, int long_or_short)
{
struct tm *tm = gmtime(&timep);
- char *format;
+ const char *format;
int n;
if (!tm) {
elname
);
}
-
}
/***********************************************************************
XML_ParserFree(psr);
}
-void xml_readprefixstring(char *str)
+void xml_readprefixstring(const char *str)
{
int len = strlen(str);
if (!XML_Parse(psr, str, len, 0)) {